package AspectoLog;

import java.io.FileWriter;
import java.io.IOException;


public aspect AspectoLogMain {
	FileWriter f = null;
	
	
	pointcut main():
		call (* *.main*(..))
			&&  !within(AspectoLogCriacao); //evita recursao 	
	before():main() {
		System.out.println(" INICIO DO MAIN !" + thisJoinPoint);
		
		
//		try {
//			f = new FileWriter("LogMain.txt");
//			
//			f.write("INICIO AspectoLogMain!!  \n");
//			f.write( thisJoinPointStaticPart.getSignature().getName() + "\n" );
//		
//		} catch (IOException e) {
//			e.printStackTrace();
//		}		
	
		// testando escrita em arquivo
		ArqLog log = new ArqLog("LogMain.log");
		log.iniciar();
		log.arquivar(thisJoinPoint);	
	}
	
}
